package chapter5.MessageSource;

import java.util.Locale;

import org.springframework.context.support.GenericXmlApplicationContext;

/**
 * 
 * @author chauthanhthang
 * @comment example with multi language
 */
public class MessageSourceDemo {
	public static void main(String[] args) {
		GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
		ctx.load("classpath:chapter5/MessageSource/messageSource.xml");
		ctx.refresh();
		Locale english = Locale.ENGLISH;
		Locale czech = new Locale("cs", "CZ");
		System.out.println(ctx.getMessage("msg", null, english));
		System.out.println(ctx.getMessage("msg", null, czech));
		System.out.println(ctx.getMessage("nameMsg", new Object[] { "Chau",
				"Thang" }, english));
	}
}
